﻿namespace Vdc.Grid
{
    using System;
    using System.Collections.Generic;

    internal class StandardFilterCriterias
    {
        public const string Contains = "1";
        public const string DoesNotContain = "2";
        public const string EndsWith = "4";
        public const string EqualTo = "5";
        public const string GreaterOrEqualThan = "10";
        public const string GreaterThan = "8";
        public const string IsEmpty = "13";
        public const string IsNotEmpty = "14";
        public const string IsNotNull = "12";
        public const string IsNull = "11";
        public const string NoFilter = "0";
        public const string NotEqualTo = "6";
        public const string SmallerOrEqualThan = "9";
        public const string SmallerThan = "7";
        public const string StartsWith = "3";

        public static string GetFilterOptionByIndex(int index)
        {
            switch (index)
            {
                case 0:
                    return "NoFilter";

                case 1:
                    return "Contains";

                case 2:
                    return "DoesNotContain";

                case 3:
                    return "StartsWith";

                case 4:
                    return "EndsWith";

                case 5:
                    return "EqualTo";

                case 6:
                    return "NotEqualTo";

                case 7:
                    return "SmallerThan";

                case 8:
                    return "GreaterThan";

                case 9:
                    return "SmallerThanOrEqualTo";

                case 10:
                    return "GreaterThanOrEqualTo";

                case 11:
                    return "IsNull";

                case 12:
                    return "IsNotNull";

                case 13:
                    return "IsEmpty";

                case 14:
                    return "IsNotEmpty";
            }
            return "";
        }

        public static FilterOptionType GetFilterTypeByIndex(int index)
        {
            switch (index)
            {
                case 0:
                    return FilterOptionType.NoFilter;

                case 1:
                    return FilterOptionType.Contains;

                case 2:
                    return FilterOptionType.DoesNotContain;

                case 3:
                    return FilterOptionType.StartsWith;

                case 4:
                    return FilterOptionType.EndsWith;

                case 5:
                    return FilterOptionType.EqualTo;

                case 6:
                    return FilterOptionType.NotEqualTo;

                case 7:
                    return FilterOptionType.SmallerThan;

                case 8:
                    return FilterOptionType.GreaterThan;

                case 9:
                    return FilterOptionType.SmallerThanOrEqualTo;

                case 10:
                    return FilterOptionType.GreaterThanOrEqualTo;

                case 11:
                    return FilterOptionType.IsNull;

                case 12:
                    return FilterOptionType.IsNotNull;

                case 13:
                    return FilterOptionType.IsEmpty;

                case 14:
                    return FilterOptionType.IsNotEmpty;
            }
            return FilterOptionType.NoFilter;
        }

        public static List<FilterOption> GetStandardFilterOptions()
        {
            return new List<FilterOption> { new FilterOption((FilterOptionType)0),
                                            new FilterOption((FilterOptionType)1),
                                            new FilterOption((FilterOptionType)2), 
                                            new FilterOption((FilterOptionType)3),
                                            new FilterOption((FilterOptionType)4), 
                                            new FilterOption((FilterOptionType)5), 
                                            new FilterOption((FilterOptionType)6), 
                                            new FilterOption((FilterOptionType)7),
                                            new FilterOption((FilterOptionType)8),
                                            new FilterOption((FilterOptionType)9),
                                            new FilterOption((FilterOptionType)10), 
                                            new FilterOption((FilterOptionType)11),
                                            new FilterOption((FilterOptionType)12),
                                            new FilterOption((FilterOptionType)13),
                                            new FilterOption((FilterOptionType)14) 
            };
        }
    }
}

